﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace SqlImEx
{
    public class Args
    {
        string[] _args;
        public Args(string[] args)
        {
            _args = args;
        }

        public string this[string arg]
        {
            get
            {
                var str = _args.FirstOrDefault(x => Regex.IsMatch(x, @"^(/|-|--)" + arg + ":"));
                if (str != null)
                    return Regex.Replace(str, @"^(/|-|--)" + arg + ":", string.Empty);
                var bol = _args.FirstOrDefault(x => Regex.IsMatch(x, @"^(/|-|--)" + arg + "$"));
                if (bol != null)
                    return bol;
                return null;
            }
        }
    }
}
